from multiprocessing import Queue


if __name__ == "__main__" :
    q = Queue(3)
    q.put('消息1')
    q.put('消息2')
    print('队列个数{%d} 队列是否已满{%s}'% (q.qsize(),q.full()))
    q.put('消息3')
    print('队列个数{%d} 队列是否已满{%s}' % (q.qsize(), q.full()))

    try:
        q.put('消息4',True,2)
    except :
        print('队列已满不能继续添加')


    print(q.get())
    print('队列个数{%d} 队列是否已满{%s}' % (q.qsize(), q.full()))

    while True :
        print(q.get())
        print(q.get_nowait())
        if q.empty() :

            break

    print('队列个数{%d} 队列是否已满{%s}' % (q.qsize(), q.full()))